#include <Windows.h>

#include <iostream>

#define DEVICE_NAME L"\\\\.\\DeviceB"

int main()
{
    HANDLE hDevice = INVALID_HANDLE_VALUE;
    DWORD NumberOfBytesRead = 0;
    do
    {
        hDevice = CreateFile(
            DEVICE_NAME,
            GENERIC_READ | GENERIC_WRITE,
            0,
            NULL,
            OPEN_EXISTING,
            FILE_ATTRIBUTE_NORMAL,
            NULL
        );
        if (INVALID_HANDLE_VALUE == hDevice)
        {
            printf("[Error] CreateFile %ws Error:%#X\r\n", DEVICE_NAME, GetLastError());
            break;
        }

        ReadFile(hDevice, NULL, 0, &NumberOfBytesRead, NULL);



    } while (false);

    if (INVALID_HANDLE_VALUE != hDevice)
    {
        CloseHandle(hDevice);
        hDevice = INVALID_HANDLE_VALUE;
    }

    getchar();

}